package com.forlove.app.qselect.login.ui;

import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.forlove.app.ForloveApplication;
import com.forlove.app.R;
import com.forlove.app.common.base.ui.BaseActivity;
import com.forlove.app.common.utils.SystemUtils;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 区域限制。提醒用户的页面
 * Created by yjl on 2017/10/9.
 */

public class LimitAreaActivity extends BaseActivity {

    @Override
    public int getLayoutId() {
        return R.layout.activity_limit_area;
    }

    private long deltTime = 0;

    @Override
    public void onBackPressed() {
        if (System.currentTimeMillis() - deltTime > 2000) {
            deltTime = System.currentTimeMillis();
            Toast.makeText(this, "再按一次退出应用", Toast.LENGTH_SHORT).show();
            return;
        }
//        super.onBackPressed();
        ForloveApplication.getInstance().exit();
    }

    @Override
    protected void onResume() {
        super.onResume();
//        StatusBarCompat.compat(this, Color.parseColor("#ffffff"));
    }

    @OnClick(R.id.follow_weibo)
    public void followWeibo(){
        if (SystemUtils.isAvilible(this,"com.sina.weibo")){
            Intent intent = new Intent();
            ComponentName cmp = new ComponentName("com.sina.weibo", "com.sina.weibo.page.ProfileInfoActivity");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.setComponent(cmp);
            intent.putExtra("uid", "6384743439");

            startActivity(intent);
        }else{
            Uri uri = Uri.parse("https://m.weibo.cn/u/6384743439");
            Intent it = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(it);
        }
    }
}
